from django.conf.urls import patterns, include, url
from tastypie.api import Api
from api.api import ImageResource, UserResource, ExcursionResource, InformationResource
import web.settings

# To enable the admin:
from django.contrib import admin
admin.autodiscover()

image_resource = ImageResource()
v1_api = Api(api_name='v1')
v1_api.register(UserResource())
v1_api.register(ImageResource())
v1_api.register(ExcursionResource())
v1_api.register(InformationResource())

urlpatterns = patterns('',     
    #pages                   
    url(r'^$', 'main.views.index', name='home'),
    url(r'^login/$', 'auth.views.login_user'),
    url(r'^register/$', 'auth.views.register_user'),

    #admin
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
	
    #api
    url( r'api/upload_file/', 'api.views.upload_file' ),
  #  url(r'^api/', include(v1_api.urls)),
)

if web.settings.DEBUG:
    urlpatterns += patterns('django.views.static',
    (r'^static_media/(?P<path>.*)$', 
        'serve', {
        'document_root': web.settings.MEDIA_ROOT,
        'show_indexes': True }),)